flatMap

inline fun <L, R, T> Either<L, R>.flatMap(transform: (R) -> Either<L, T>): Either<L, T>

Maps value of this Right to a new Either using transform.

Return

Either mapped using transform or this object if this is a Left.

Since

1.3

Parameters

transform

Function transforming a Right to an Either.

inline fun <L, R, T> LeftProjection<L, R>.flatMap(transform: (L) -> Either<T, R>): Either<T, R>

Maps value of this Left to a new Either using transform.

Return

Either mapped using transform or this object if this is a Right.

Parameters

transform

Function transforming a Left to an Either.

inline fun <L, R, T> RightProjection<L, R>.flatMap(transform: (R) -> Either<L, T>): Either<L, T>

Maps value of this Right to a new Either using transform.

Return

Either mapped using transform or this object if this is a Left.

Parameters

transform

Function transforming a Right to an Either.